﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Buy1a00
    {
        private int? _providercode;
		private string _providername;
		private string _typecode;
        private int? _status;
        private DateTime? _cdate;
		private string _bankname;
		private string _accountno;
		private string _taxno;
		private string _principalname;
		private string _ntel;
		private string _fax;
		private string _usercode;
		private string _address;
		private string _listid;
        private int? _pdate;
		
        /// <summary>
        /// 供应商代码
        /// </summary>
		public int? Providercode
		{
			get { return _providercode;	 }
			set { _providercode=value;	}
		}
        /// <summary>
        /// 供应商名称
        /// </summary>
		public string Providername
		{
			get { return _providername;	 }
			set { _providername=value;	}
		}
        /// <summary>
        /// 类型
        /// </summary>
		public string Typecode
		{
			get { return _typecode;	 }
			set { _typecode=value;	}
		}
        /// <summary>
        /// 系统状态
        /// </summary>
		public int? Status
		{
			get { return _status;	 }
			set { _status=value;	}
		}
        /// <summary>
        /// 创建日期
        /// </summary>
		public DateTime? Cdate
		{
			get { return _cdate;	 }
			set { _cdate=value;	}
		}
        /// <summary>
        /// 银行
        /// </summary>
		public string Bankname
		{
			get { return _bankname;	 }
			set { _bankname=value;	}
		}
        /// <summary>
        /// 帐号
        /// </summary>
		public string Accountno
		{
			get { return _accountno;	 }
			set { _accountno=value;	}
		}
        /// <summary>
        /// 税号
        /// </summary>
		public string Taxno
		{
			get { return _taxno;	 }
			set { _taxno=value;	}
		}
        /// <summary>
        /// 负责人
        /// </summary>
		public string Principalname
		{
			get { return _principalname;	 }
			set { _principalname=value;	}
		}
        /// <summary>
        /// 联系电话
        /// </summary>
		public string Ntel
		{
			get { return _ntel;	 }
			set { _ntel=value;	}
		}
        /// <summary>
        /// 传真
        /// </summary>
		public string Fax
		{
			get { return _fax;	 }
			set { _fax=value;	}
		}
        /// <summary>
        /// 用户名
        /// </summary>
		public string Usercode
		{
			get { return _usercode;	 }
			set { _usercode=value;	}
		}
        /// <summary>
        /// 地址
        /// </summary>
		public string Address
		{
			get { return _address;	 }
			set { _address=value;	}
		}
        /// <summary>
        /// 主键标识
        /// </summary>
		public string Listid
		{
			get { return _listid;	 }
			set { _listid=value;	}
		}
        /// <summary>
        /// 准备天数
        /// </summary>
		public int? Pdate
		{
			get { return _pdate;	 }
			set { _pdate=value;	}
		}
		
		public static List<Buy1a00> GetBuy1a00ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Buy1a00> list = new List<Buy1a00>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Buy1a00 model = GetBuy1a00ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Buy1a00 GetBuy1a00ByDataRow(DataRow dr)
		{
			Buy1a00 model = new Buy1a00(); //实例化Buy1a00
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("providercode")&&!(dr["providercode"] is System.DBNull))  
				model.Providercode = ( int)dr["providercode"];
			if (dcc.Contains("providername")&&!(dr["providername"] is System.DBNull))  
				model.Providername = ( string)dr["providername"];
			if (dcc.Contains("typecode")&&!(dr["typecode"] is System.DBNull))  
				model.Typecode = ( string)dr["typecode"];
			if (dcc.Contains("status")&&!(dr["status"] is System.DBNull))  
				model.Status = ( int)dr["status"];
			if (dcc.Contains("cdate")&&!(dr["cdate"] is System.DBNull))  
				model.Cdate = ( DateTime)dr["cdate"];
			if (dcc.Contains("bankname")&&!(dr["bankname"] is System.DBNull))  
				model.Bankname = ( string)dr["bankname"];
			if (dcc.Contains("accountno")&&!(dr["accountno"] is System.DBNull))  
				model.Accountno = ( string)dr["accountno"];
			if (dcc.Contains("taxno")&&!(dr["taxno"] is System.DBNull))  
				model.Taxno = ( string)dr["taxno"];
			if (dcc.Contains("principalname")&&!(dr["principalname"] is System.DBNull))  
				model.Principalname = ( string)dr["principalname"];
			if (dcc.Contains("ntel")&&!(dr["ntel"] is System.DBNull))  
				model.Ntel = ( string)dr["ntel"];
			if (dcc.Contains("fax")&&!(dr["fax"] is System.DBNull))  
				model.Fax = ( string)dr["fax"];
			if (dcc.Contains("usercode")&&!(dr["usercode"] is System.DBNull))  
				model.Usercode = ( string)dr["usercode"];
			if (dcc.Contains("address")&&!(dr["address"] is System.DBNull))  
				model.Address = ( string)dr["address"];
			if (dcc.Contains("listid")&&!(dr["listid"] is System.DBNull))  
				model.Listid = ( string)dr["listid"];
			if (dcc.Contains("pdate")&&!(dr["pdate"] is System.DBNull))  
				model.Pdate = ( int)dr["pdate"];
			
			return model;
		}
    }
}
